#ifndef DATA_DETAIL_H
#define DATA_DETAIL_H

#include <string>
#include "Common/Algebra/Transform.h"
#include "Common/Collections/Vector.h"
#include "Data/Objects/Model.h"
#include "Data/Objects/Rule.h"

namespace data {

	class Detail {
	public:
		Detail(
			std::string id,
			const cmn::Transform& position,
			std::string modelFileName ) :
			m_id( id ),
			m_position( position ),
			m_modelFileName( modelFileName )
		{
			m_rules = new cmn::Vector<Rule>();
		}

		Detail( const Detail& detail ) :
			m_id( detail.GetId() ),
			m_position( detail.GetPosition() ),
			m_modelFileName( detail.GetModelFileName() )
		{
			m_rules = new cmn::Vector<Rule> ( detail.GetRules() );
		}

		~Detail() {
			delete m_rules;
		}

		inline const std::string GetId() const { return m_id; }
		inline void SetId( std::string id ) { m_id = id; }

		inline const cmn::Transform GetPosition() const { return m_position; }
		inline void SetPosition( const cmn::Transform& position ) { m_position = position; }

		inline const std::string GetModelFileName() const { return m_modelFileName; }
		inline void SetModelFileName( std::string modelFileName ) { m_modelFileName = modelFileName; }

		inline void AddRule( const Rule& rule ) { m_rules->Add( rule ); }
		inline void RemoveRule( const Rule& rule ) { m_rules->Remove( rule ); }
		inline const cmn::IIterable<Rule>* GetRules() const { return m_rules; }

	private:
		std::string m_id;
		cmn::Transform m_position;
		std::string m_modelFileName;
		cmn::Vector<Rule>* m_rules;
	};

	inline bool operator == ( const Detail& a, const Detail& b ) {
		if( a.GetId() != b.GetId() ) return false;
		if( a.GetPosition() != b.GetPosition() ) return false;
		if( a.GetModelFileName() != b.GetModelFileName() ) return false;

		if( !IterablesAreEqual( a.GetRules(), b.GetRules() ) ) return false;

		return true;
	}

	inline bool operator != ( const Detail& a, const Detail& b ) {
		return !( a == b );
	}
}
#endif
